package com.geekaca.d09;

import java.io.*;

public class TesTryWithResources2 {
    public static void main(String[] args) throws FileNotFoundException {
        InputStream is = new FileInputStream("Hello.txt");
        OutputStream os =new FileOutputStream("hi.txt"  );
        try(is;os){
            byte[ ] buffer =new byte[1024];
            int len;
            while ((len= is.read(buffer))!=-1){
                os.write(buffer,0,len);
            }
            System.out.println("复制完成.");
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
